/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *//*

package cn.tedu.mall.front.sentinel;

import cn.tedu.mall.common.exception.CoolSharkServiceException;
import cn.tedu.mall.common.restful.JsonPage;
import cn.tedu.mall.common.restful.JsonResult;
import cn.tedu.mall.common.restful.ResponseCode;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class FrontSpuFallBack {
    public static JsonResult seckillBlock(Long categoryId, Integer page, Integer pageSize, Throwable throwable) {
        if (throwable instanceof CoolSharkServiceException) {
            log.debug("利用categoryId查询spu列表进入降级，返回null值");
            return JsonResult.ok(JsonPage.restPage(new PageInfo<>(null)));
        }
        //如果不是null那么是系统异常
        log.debug("未知系统异常：{}", throwable.getMessage());
        throw new CoolSharkServiceException(ResponseCode.INTERNAL_SERVER_ERROR, "未知系统异常");
    }
}
*/
